/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.repositoryManager;

import cz.mzk.oai.repositoryManager.collections.CollectionEntity;
import cz.mzk.oai.repositoryManager.collections.CollectionManager;
import cz.mzk.oai.repositoryManager.collections.CollectionManagerImpl;
import cz.mzk.oai.repositoryManager.oaiId.OaiIdManagerImpl;
import cz.mzk.oai.repositoryManager.oaiId.OaiIdentifierEntity;

/**
 *
 * @author Martin Rehanek (rehan@mzk.cz)
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //initRepository();
        addItem();
    }

    public static void addItem() {
//        CollectionManager collectionManager = new CollectionManagerImpl();
//        CollectionEntity collection = collectionManager.findCollection("testCollection");
//        OaiIdManagerImpl oaiIdManager = new OaiIdManagerImpl();
//        OaiIdentifierEntity oaiId = oaiIdManager.findOaiId("MZK03", "123456");
//        ItemManager itemManager = new ItemManagerImpl();
//        itemManager.addNewItem(oaiId, collection);
    }

    public static void initRepository() {
        CollectionManager collectionManager = new CollectionManagerImpl();
        try {
            CollectionEntity collection = collectionManager.createCollection("testCollection");
            OaiIdManagerImpl oaiIdManager = new OaiIdManagerImpl();
            OaiIdentifierEntity oaiId = oaiIdManager.createOaiId("MZK03", "123456");
            //          ItemManager itemManager = new ItemManagerImpl();
//            ItemEntity newItem = itemManager.addNewItem(oaiId, collection);
        } catch (EntityPresentException ex) {
            System.err.println("entity " + ex.getEntityClassName() + " already present. " + ex.getMessage());
        }
    }
}
